home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1999 March
/
EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso
/
earcd
/
emul
/
cp4
/
support
/
playsid3.0
/
convert.doc
< prev
next >
Wrap
Text File
|
1999-01-01
|
11KB
|
362 lines
**************************************************************
****** HOW TO CONVERT C64 TUNES TO AMIGA PLAYSID FORMAT ******
**************************************************************
Requirements:
* You have to know 6502 machinecode quite well.
* You have access to a C64 or a good Emulator
* You have an good machine code monitor to your C64 or Emulator
and it will be easier if...
* You have a 1541 diskdrive
* You have a transfer cable C64-Amiga
* You have already ripped tunes
* You know a lot about SID
Ripping:
This is often a hard thing to do. You should locate where in
memory that the musicplayer and data is. If it is spread into
several parts, then you have to write memory transfer routines.
You should find where to call to init and start the different
tunes. You then save the music in one (this is very important)
file. You should always try to locate as many tunes or sounds
as possible, so that nothing is forgotten. Otherwise your job
maybe will be re-done by another guy who has found more tunes.
Converting:
This is easier. If you have already ripped tunes that consists
of more than one file, see instructions on ripping. Now you
should rewrite the music player so that it can be thought of as
two major subroutines (sometimes this is already the case, like
Maniacs of Noise). The first subroutine will be called by PlaySID
with the accumulator set to the tunenumber (hex $00-$FF). This
should initalize all things like volume etc. The second subroutine
is the real music playing part. This will be called by PlaySID
each 1/50 or 1/60 second (set by parameters in .info). Note that
this routine routine should be ended by either RTI, RTS or a jump
to address $Exxx (this because the non-used bytes at $E000-FFFF is
filled with $40=RTI). If you use RTS you must then also check that
the stackpointer is ok (the same as when called from PlaySID).
Note that the memory transfer routines should be in the first
subroutine. Note also that PlaySID initializes all 64k of memory and
reloads the musicplayer each time you press play. Note also that
the memory control register ($01) is of nearly no use under PlaySID.
It sees all memory as ram (even $D000-$DFFF!).
Sometimes the music uses the fourth channel, like sample channel.
This is done by changing the volume ($D418) very often. Usually
this is programmed using the NMI ($0318 or $FFFA). PlaySID uses
another metod. The SID registers are enhanced with several new
registers, see below. You have to write a routine that is a part
of the second subroutine. This routine replaces the NMI routine,
and with that follows that the NMI routine are not used anymore. For
some examples look below (although they're not NMI's but they'll
explain the way to convert). Please always write to the START reg
($D41D) after you have set the other regs, for future revisions
of PlaySID.
Transfering:
When you transfer the files, you don't have to remove the
2 bytes in the beginning of the file (if you let them be, you
could also use the files in some C64emulator that maybe will be
released). If you haven't got the opportunity to transfer by
yourself, you could send the files to us (the authors of PlaySID)
on a 5 1/4 disk or even cassette. If you do, the you must
include the information about the .info parameters.
Making the Icon:
Just copy an icon from an existing PlaySID file. For example
copy arkanoid.info to <filename>.info. Then select the icon in
workbench and select Information in the workbench menu. Now you
change the parameters to that of your file. Look at PlaySID.doc
for a complete description of the parameters. It is very much
appreciated that you also include information about author and
copyright. You could even include lines like RIPPER="xxxx" or
VERSION="xxxxx", because these lines are not seen by PLAYSID.
New Icon Tooltype Features (V2.2):
If 0 is specified as loadaddress, the first two bytes of the file
will instead be used as loadaddress.
If 0 is specified as initaddress, then the initaddress will be the
first C64 address loaded.
If 0 is specified as playaddress, then the playaddress will be the
address of the interrupt initialized by the subroutine at the
initaddress. This address will be the contents of $0314/0315 or
$FFFE/FFFF depending on what value $0001 contains.
SPEED = <speeddata> ;in hex
speeddata contains info about playspeed. For each tune a bit
is reserved, bit 0 for tune nr 1 and so on. A 0 bit means vertical
sync (50Hz PAL or 60Hz NTSC) and a 1 bit means 60 Hz or the
time set in $DC04/05. Default value is 0 for all bits.
Appendix:
*********************
* NEW SID REGISTERS *
*********************
ADDRESS VALUE FUNCTION USAGE
D41D 00-FC Nr of tones-1 Galway-Noise (START)
FD Stop Sampling Sample (STOP)
FC Start Sampling with 1/4 Sample (START)
volume
FE Start Sampling with 1/2 Sample (START)
volume
FF Start Sampling Sample (START)
ex. 4-bit sample -> FF
3-bit sample (one extra LSR)
-> FE etc.
note. only write to this reg
after setting the other
regs to proper values.
D41E 00-FF ToneData address lowbyte Galway-Noise
D41F 00-FF ToneData address highbyte Galway-Noise
D41E 00-FF SampleData address low Sample
D41F 00-FF SampleData address high Sample
D43D 00-FF Tonelength (in samples) Galway-Noise
D43E 00-0F Volume of Noise Galway-Noise
D43D 00-FF SampleData end addr. low Sample
D43E 00-FF SampleData end addr. high Sample
D43F 00-FF Period for each value of Galway-Noise
ToneData (in C64-cycles)
00-FE Nr times of Repeat Sample
FF Continious sample Sample
D45D 00-FF Period for value 0 of Galway-Noise
ToneData (in C64-cycles)
00-FF Period for samples lowbyte Sample
D45E 00-FF Period for samples highbyte Sample
(in C64-cycles)
ex. the period is usually the
value of the timer on 6526
($DD04,05 etc.) which handles
the NMI-irq used
D45F 00,01 Nr of bytes to add after Sample
02,04 Reading one nibble (4 bits)
08... (i.e. Octave) ,usually 00
ex. xx xx xx xx ... -> 00
x_ x_ x_ x_ ... -> 01
x_ __ x_ __ ... -> 02 etc.
D47D 00 Sampleorder: Lownibble Sample
,Highnibble (the most used)
01 Sampleorder: Highnibble Sample
,Lownibble
ex. (12 34 -> 1 2 3 4) -> 01
(12 34 -> 2 1 4 3) -> 00
D47E 00-FF SampleData repeataddress low Sample
D47F 00-FF SampleData repeataddress high Sample
* EXAMPLES *
; *** MARTIN GALWAY *** *** NOISE ***
; 6502 Routine:
; Loop of Y=5 to 0 step -1
; Loop of X=19 to 0 step -1
; Read $B64E,Y in A
; Wait A*73 cycles
; Wait 22 cycles
; Add 7 to volume
; End Loop X
; End Loop Y
; END
;
; Replacement with:
; D43D=$19
; D41E=$4E, D41F=$B6
; D43F=$73
; D45D=$22
; D43E=$07
; D41D=$05
;
; *** MARTIN GALWAY *** *** SAMPLE ***
; 6502 Routine:
; Loop of Y=0 to 100 step 1
; Read $B64E,Y in A
; Write Lownibble of A in Volumereg
; Wait 74 cycles
; Write Highnibble of A in Volumereg
; Wait 74 cycles
; End Loop Y
; Do it one more time
; END
;
; Replacement with:
; D41E=$4E, D41F=$B6
; D43D=$4E, D43E=$B7
; D45D=$74, D45E=$00
; D45F=$00
; D47D=$00
; D43F=$01
; D47E=$4E, D47F=$B6
; D41D=$FF
;
;
; *** ORDINARY SAMPLE ***
; 6502 NMI-irq Routine:
; Checks if all is played ($FC,$FD = $FE,$FF ?)
; Loads next byte with LDA ($FC),Y (Y = 0) ,if so required
; Shift outs the highnibble , if so required
; Stores this value in $D418
; Exits (RTI)
;
; Replacement with:
; Locate the routine which initalizes the values $FC-$FF and which starts
; the NMI-irq (Probably with LDA #$81,STA $DD0D ,LDA #$xx,STA $DD04
; LDA #$yy,STA DD05 etc.)
; Do instead this,
; D41E,1F = value of adress $FC,FD
; D43D,3E = value of adress $FE,FF
; D43F = 00 , D45F = 00
; D47D = 00 or 01
; D45D,5E = value of address $DD04,05
; D41D = FF
;
***********************************
* UNIMPLEMENTED 6502 INSTRUCTIONS *
***********************************
Complete list of the unimplemented instructions for the 6510 microprocessor.
(C) 1984,1992 Håkan Sundell
Notes: In the listing belove there are some shortcuts used, A = Accumulator
, X = Index register X , Y = Index register Y , SP = Stackpointer
, M = byte in Memory , -> = is Stored in. The flag settings are,
unless other specified, calculated in the same way as the consisting
intructions.
Code Adress-mode Description
02 --- Total HALT
03 (Ind,X) ASL,ORA
04 Zeropage NOP
07 Zeropage ASL,ORA
0B Immediate AND #$xx,ASL A with only setting flags
0C Absolute NOP
0F Absolute ASL,ORA
12 --- Total HALT
13 (Ind),Y ASL,ORA
14 Zeropage NOP
17 Zeropage,X ASL,ORA
1A Implied NOP
1B Absolute,Y ASL,ORA
1C Absolute NOP
1F Absolute,X ASL,ORA
22 --- Total HALT
23 (Ind,X) ROL,AND
27 Zeropage ROL,AND
2B Immediate AND #$xx,ROL A with only setting flags
2F Absolute ROL,AND
32 --- Total HALT
33 (Ind),Y ROL,AND
34 Zeropage NOP
37 Zeropage,X ROL,AND
3A Implied NOP
3B Absolute,Y ROL,AND
3C Absolute NOP
3F Absolute,X ROL,AND
42 --- Total HALT
43 (Ind,X) LSR,EOR
44 Zeropage NOP
47 Zeropage LSR,EOR
4B Immediate AND #$xx,LSR A
4F Absolute LSR,EOR
52 --- Total HALT
53 (Ind,Y) LSR,EOR
54 Zeropage NOP
57 Zeropage,X LSR,EOR
5A Implied NOP
5B Absolute,Y LSR,EOR
5C Absolute NOP
5F Absoulte,X LSR,EOR
62 --- Total HALT
63 (Ind,X) ROR,ADC
64 Zeropage NOP
67 Zeropage ROR,ADC
6B Immediate AND #$xx,ROR A
6F Absoulte ROR,ADC
72 --- Total HALT
73 (Ind),Y ROR,ADC
74 Zeropage NOP
77 Zeropage,X ROR,ADC
7A Implied NOP
7B Absolute,Y ROR,ADC
7C Absolute NOP
7F Absolute,X ROR,ADC
80 Zeropage NOP
82 Zeropage NOP
83 (Ind,X) 0->M if X=0 , No flags set
87 Zeropage A and X -> M , No flags set
8B Immediate M and X -> A (bits 7-1) , M0 and X0 and A0 -> A0
, No flags set
8F Absolute A and X -> M , No flags set
92 --- Total HALT
93 (Ind),Y A and X and $21 -> M , No flags set
97 Zeropage,Y A and X -> M , No flags set
9B Absolute,Y A and X and $21 -> M , A and X -> SP, No flags set
9C Absolute,X A and Y and $21 -> M , No flags set
9E Absolute,Y A and X and $21 -> M , No flags set
9F Absolute,Y A and X and $21 -> M , No flags set
A3 (Ind,X) LDA,LDX
A7 Zeropage LDA,LDX
AB Immediate LDA,LDX
AF Absolute LDA,LDX
B2 --- Total HALT
B3 (Ind),Y LDA,LDX
B7 Zeropage,Y LDA,LDX
BB Absolute,Y SP and M -> A,X,SP
BF Absolute,Y LDA,LDX
C2 Zeropage NOP
C3 (Ind,X) DEC,CMP
C7 Zeropage DEC,CMP
CB Immediate (X and A) - M -> X
CF Absolute DEC,CMP
D2 --- Total HALT
D3 (Ind),Y DEC,CMP
D4 Zeropage NOP
D7 Zeropage,X DEC,CMP
DA Implied NOP
DB Absolute,Y DEC,CMP
DC Absolute NOP
DF Absolute,X DEC,CMP
E2 Zeropage NOP
E3 (Ind,X) INC,SBC
E7 Zeropage INC,SBC
EB Immedite SBC #$xx
EF Absolute INC,SBC
F2 --- Total HALT
F3 (Ind),Y INC,SBC
F4 Zeropage NOP
F7 Zeropage,X INC,SBC
FA Implied NOP
FB Absolute,Y INC,SBC
FC Absolute NOP
FF Absolute,X INC,SBC